<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link
      href="https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.min.css"
      rel="stylesheet"
    />
    <style>
      /* 进来中，离开中 */
      /* .fade-enter-active,
      .fade-leave-active {
        transition: all 1s ease;
      } */

      /* 进来前，离开后 */
      /* .fade-enter-from,
      .fade-leave-to {
        opacity: 0;
      } */

      /* .fade-enter-from {
        transform: translateX(40px);
        opacity: 0;
      }
      .abc {
        transform: translateX(-40px);
        opacity: 0;
      } */
      p {
        width: 32px;
      }
    </style>
  </head>
  <body>
    <div id="app">
      <h2>过渡动画</h2>
      <!-- <button @click="show = !show">btn</button> -->
      <!-- 如果v-if的元素，想要过渡或者动画，那么需要加一个transition标签 -->
      <!-- transition标签需要一个name属性 -->
      <!-- <transition name="fade" leave-to-class="abc">
        <p v-if="show">hello</p>
      </transition> -->

      <button @click="show = !show">btn</button>
      <transition
        name="fade"
        enter-active-class="animate__animated animate__flipInY"
        leave-active-class="animate__animated animate__rollOut"
      >
        <p v-if="show">你好</p>
      </transition>
    </div>

    <script src="./lib/vue3.js"></script>
    <script>
      const { createApp } = Vue;

      createApp({
        data() {
          return {
            show: true,
          };
        },
      }).mount("#app");
    </script>
  </body>
</html>
